From: | Ben Hutchings |
Date: | 03 Aug 99 at 00:25:45 |
Subject: | Re: Input buffering weirdness (was Status of pools.lib) |
From: Ben Hutchings <womble@zzumbouk.demon.co.uk>
On Fri, Jul 30, 1999 at 03:21:01AM +0200, Andrija Antonijevic wrote:
<snip>
> When run:
>
> 16.Ram Disk:> Test
> Abc<NL><EOF>
> 5 bytes read:
> 0A4162630A
> ~~
> Notice the newline before my input? When I uncomment Flush(Input())
> everything works fine:
>
> 16.Ram Disk:> Test
> Abc<NL><EOF>
> 4 bytes read:
> 4162630A
>
> No newline at the beginning... Am I missing something, should I have
> expected this to happen? (I tried this with normal CON and KingCON,
> compiled with SAS/C and gcc).
When the shell starts a command, it puts the command arguments into
the buffer of the standard input stream. I think this is done for
ancient compatibility with BCPL programs; maybe this is how TRIPOS
passes command arguments.
Arguments start after the first blank after the command name, and
continue up to and including the end-of-line, so in this case they
consist of just the new-line character.
This is hinted at in the autodocs for CreateNewProc, ReadArgs,
RunCommand and SetVBuf.